package com.example.selectdorm.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;

@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "user_info",
        uniqueConstraints = {
            @UniqueConstraint(name = "student_id_unique",columnNames = "student_id")
        }
)
public class UserInfo {

    @Id
    @SequenceGenerator(
            name = "uid_sequence",
            sequenceName = "uid_sequence",
            allocationSize = 10
    )
    @GeneratedValue(
            strategy = GenerationType.SEQUENCE,
            generator = "uid_sequence"
    )
    @Column(
            name = "id",
            updatable = false
    )
    private Long id;

    @Column(
            name = "student_id",
            nullable = false
    )
    private String studentId;

    @Column(
            name = "student_name",
            nullable = false
    )
    private String studentName;

    @Column(
            name = "gender",
            nullable = false
    )
    private String gender;

    @Column(
            name = "email",
            nullable = false
    )
    private String email;

    @Column(
            name = "phone_number",
            nullable = false
    )
    private String phoneNumber;


    public UserInfo(String studentId, String studentName, String gender, String email, String phoneNumber) {
        this.studentId = studentId;
        this.studentName = studentName;
        this.gender = gender;
        this.email = email;
        this.phoneNumber = phoneNumber;
    }
}
